import axiosInstance from '@/api/axiosInstance'

// 定义查询参数对象
interface categoryListParams {
  name?: string
  page?: number
  pageSize?: number
  // 其他查询条件...
}

/**
 * 获取列表
 */
export const getCategoryList = async (params?: categoryListParams) => {
  return axiosInstance.get('/admin/category', { params })
}

/**
 * 创建
 */
export const createCategory = async (data: any) => {
  return axiosInstance.post('/admin/category', data)
}

export const getCategoryDetail = async (id: number) => {
  return axiosInstance.get(`/admin/category/${id}`)
}

export const updateCategory = async (id: number, data: any) => {
  return axiosInstance.put(`/admin/category/${id}`, data)
}

/**
 * 删除
 * @param id
 */
export const deleteCategory = async (id: number) => {
  return axiosInstance.delete(`/admin/category/${id}`)
}
